package pmg;

import static org.junit.Assert.assertEquals;
import pmg.test.RobotTestBed;
import robocode.control.events.TurnEndedEvent;
import robocode.control.snapshot.IRobotSnapshot;
import robocode.control.snapshot.ITurnSnapshot;

/**
 * Tests WallEE's initial heading before it turns and heads to a wall.
 * 
 * @author Paul Galiza
 */
public class TestWallEEInitialHeading extends RobotTestBed {

  /**
   * Uses only WallEE.
   * 
   * @return The comma-delimited list of robots in this match.
   */
  @Override
  public String getRobotNames() {
    return "pmg.WallEE";
  }

  /**
   * This test runs for 1 rounds.
   * 
   * @return The number of rounds.
   */
  @Override
  public int getNumRounds() {
    return 5;
  }

  /**
   * Tests WallEE's initial heading.
   * 
   * @param event the event snapshot
   */
  @Override
  public void onTurnEnded(TurnEndedEvent event) {
    ITurnSnapshot snapshot = event.getTurnSnapshot();
    IRobotSnapshot[] robots = snapshot.getRobots();

    double heading = robots[0].getBodyHeading();

    // turnLeft to face a wall.
    double correctheading = heading % 90;

    assertEquals("Test for robot's heading", heading, correctheading, 1);
  }
}
